//
//  XiangHaHomeInfo.m
//  CookDemo
//
//  Created by   on 15/9/3.
//  Copyright (c) 2015年 DTR. All rights reserved.
//

#import "XiangHaHomeInfo.h"

@implementation XiangHaHomeInfo

- (instancetype)initSetXiangHaHomeInfoValueForKeyWithDictionary:(NSDictionary *)dictonary {
    self = [super init];
    if (self) {
        self.title = [NSMutableArray new];
        self.date = [NSMutableArray new];
        self.type = [NSMutableArray new];
        self.time = [NSMutableArray new];
        self.url = [NSMutableArray new];
        self.img = [NSMutableArray new];
        self.imgs = [NSMutableArray new];
        self.tagsName = [NSMutableArray new];
        self.tagsUrl = [NSMutableArray new];
        self.tagsIsHot = [NSMutableArray new];
        self.codeHotUser = [NSMutableArray new];
        self.nickNameHotUser = [NSMutableArray new];
        self.imgHotUser = [NSMutableArray new];
        self.hotNumHotUser = [NSMutableArray new];
        self.isGourmetHotUser =[NSMutableArray new];
        self.codeNouses = [NSMutableArray new];
        self.titleNouses = [NSMutableArray new];
        self.imgNouses = [NSMutableArray new];
        [self setValuesForKeysWithDictionary:dictonary];
    }
    return self;
}

+ (instancetype)XiangHaHomeSetXiangHaHomeInfoValueForKeyWithDictionary:(NSDictionary *)dictonary {
    return [[XiangHaHomeInfo alloc]initSetXiangHaHomeInfoValueForKeyWithDictionary:dictonary];
}

- (void)setValue:(id)value forUndefinedKey:(NSString *)key {
    if ([key isEqualToString:@"recommend"]) {
    
        for (NSDictionary *dic in value) {
            [self.title addObject: dic[@"title"]];
            [self.date addObject:dic[@"date"]];
            [self.type addObject:dic[@"type"]];
            [self.time addObject:dic[@"time"]];
            [self.url addObject:dic[@"url"]];
            [self.img addObject:dic[@"img"]];
            [self.imgs addObject:dic[@"imgs"]];
        }
           }
    if ([key isEqualToString:@"health"]) {
        self.hour = value[@"hour"];
        self.meishi = value[@"meishi"];
        self.tizhi = value[@"tizhi"];
    }
    
    if ([key isEqualToString:@"fenlei"]) {
        self.typeFenlei = value[0][@"type"];
        for (NSDictionary *dic in value[0][@"tags"]) {
            [self.tagsName addObject:dic[@"name"]];
            [self.tagsIsHot addObject:dic[@"isHot"]];
            [self.url addObject:dic[@"url"]];
        }
    }
    if ([key isEqualToString:@"hotUser"]) {
        for (NSDictionary *dic in value) {
            [self.codeHotUser addObject: dic[@"code"]];
            [self.nickNameHotUser addObject: dic[@"nickName"]];
            [self.imgHotUser addObject: dic[@"img"]];
            [self.hotNumHotUser addObject: dic[@"hotNum"]];
            [self.isGourmetHotUser  addObject:dic[@"isGourmet"]];
        }
    }
    
    if ([key isEqualToString:@"nouses"]) {
        for (NSDictionary *dic in value) {
            [self.codeNouses addObject:dic[@"code"]];
            [self.titleNouses addObject:dic[@"title"]];
            [self.imgNouses addObject:dic[@"img"]];
        }
    }
}

@end
